<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div class="parent">
        <div class="screen">0</div>
        <div class="ctrl">
            <button id='plusButton'>+</button>
            <button id='minusButton'>-</button>
        </div>
    </div>
    <style>
        *{
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        .parent{
            width: 500px;
            height: 300px;
            background-color:rgb(75, 174, 255);
            margin: 0 auto;
        }
        .parent .screen{
            width: 200px;
            height: 150px;
            font-size: 50px;
            line-height: 150px;
            color: rgb(255, 255, 255);
            margin: 0 auto;
            text-align: center;
        }
        .parent .ctrl{
            width: 300px;
            height: 150px;
            margin: 0 auto;

            display: flex;
            justify-content: space-between;
            align-items: center;
           }
        .parent .ctrl button{
            width: 100px;
            height: 50px;
            font-size: 20px;
            text-align: center;
            border-radius: 10px;
            border: none;
        }
        .parent .ctrl button:active{
            color: salmon;
            background-color: springgreen;
        }
    </style>
    <script>
        let plusButton = document.querySelector('#plusButton');
        plusButton.onclick = function(){
            //1取screen元素
            let screen = document.querySelector('.screen');
            //2取出其中的内容
            let content = screen.innerHTML;
            //3把内容+1
            let result = parseInt(content) + 1;
            //4把内容写回
            screen.innerHTML = result;
        }
        let minusButton =document.querySelector('#minusButton');
        minusButton.onclick = function(){
            //取出screen元素
            let screen = document.querySelector(".screen");
            //取出其中的内容
            let content = screen.innerHTML;
            //内容-1;
            let result = parseInt(content)-1;
            //写回内容
            screen.innerHTML = result;
        }

    </script>
</body>
</html>